<template>
  <div class="shop">
    <div class="header">
        <div class="h-img-div"><img src="" alt="" id="headimg" :onerror="errorImg01"></div>
        <div class="shop-info">
            <h1>JJ烤肉店&nbsp;&nbsp;></h1>
            <span>营业中</span>
        </div>
    </div>
    <div class="shop-menu">
        <div class="tab-item">
          <router-link to="/ask">
            <span class="icon iconfont icon-wenda"></span>
            <p class="text">商品</p>
          </router-link>
        </div>
        <div class="tab-item">
          <router-link to="/order">
            <span class="icon iconfont icon-faxian"></span>
            <p class="text">评价</p>
          </router-link>
        </div>
        <div class="tab-item">
          <router-link to="/shop">
            <span class="icon iconfont icon-wode"></span>
            <p class="text">财务</p>
          </router-link>
        </div>
        <div class="tab-item">
          <router-link to="/mine">
            <span class="icon iconfont icon-wode"></span>
            <p class="text">配送</p>
          </router-link>
        </div>
    </div>
    
    <div class="shop-data">
        <mt-cell title="经营数据" to="/mineinfo" is-link></mt-cell>
        <div class="data-detail">
            <div class="data-cell">
                <h1>今日营业额</h1>
                <span>{{shopObj.today_money}}</span>
            </div>
            <div class="data-cell">
                <h1>今日订单数</h1>
                <span>{{shopObj.today_num}}</span>
            </div>
            <div class="data-cell">
                <h1>本月营业额</h1>
                <span>{{shopObj.month_money}}</span>
            </div>
        </div>
    </div>
    <div class="dengc">
      <mt-button type="primary" @click="toexit">退出登录</mt-button>
    </div>
    
  </div>
</template>

<script>
import {exit,saveHeadimg} from 'common/js/localStorage.js'
import axios from 'axios'
import { HOST} from 'common/js/constdata.js'
export default {
  data() {
    return {
      errorImg01: 'this.src="' + require('../.././assets/img_tx.jpg') + '"',
      shopObj : ''
    }
  },
  mounted() {
    let token = localStorage.getItem("access_token");
    axios.post("/api/index",{"access_token":token}).then((res) => {
      res = res.data
      if(res.result == 'success'){
        this.shopObj = res.data
      }
    })
      
  },
  methods:{
    toexit(){
      exit();
      this.$router.push({ path: '/login' })
    }
    
  }
 
}
</script>

<style lang="stylus">
.mar-top15
  margin-top:15px
hr
  margin:0
  color:#ccc
  background:#ccc
.shop
    background:#f2f2f2
    height:100%
    width:100%
    position:absolute
    top:0
    left:0
    .shop-menu
        margin-top:113px
        width:100%
        height:68px
        display:flex
        background-color: #fff
        .tab-item
            flex:1
            display:inline-block
            height:70px
            line-height:70px
            position:relative
            border-right:1px solid #eee
            &:last-child
                border-right:none
            .icon
                position: absolute
                top: 8px
                left: 40px
                font-size: 20px
                height: 30px
                line-height: 30px
            .text
                position: absolute
                top: 40px
                left: 35px
                font-size: 14px
                height: 20px
                line-height: 20px
    .dengc
        padding:10px 20px
        position: absolute
        width: 90%
        bottom: 50px
        .mint-button
          width:100%
    .shop-data
        margin-top:10px
        .data-detail
            background:#fff
            border-top:1px solid #ccc
            display:flex
        .data-cell
            flex:1
            text-align:center
            border-right:1px solid #eee
            margin:15px 0
            &:last-child
                border-right:none
            h1
                font-size:14px
                margin-bottom:8px
            span
                font-size:16px
                color:#333
                font-weight:700
            p
                font-size:12px
                margin-top:10px
                color:#696969
            
    .header
        position: fixed
        top: 0
        left: 0
        width: 100%
        box-shadow: 0 2px 10px 0 rgba(0,0,0,0.1)
        background-color: #108ee9
        z-index: 8
        color: #666
        display:flex
        padding:25px
        .h-img-div
            flex:0 0 55px
            img
                width:50px
                height:50px
        .shop-info
            flex:1
            margin-left:20px
            color:#fff
            h1
                margin:10px 0
            a
                font-size:12px
                color:#d8d8d8
            span
                font-size:12px
                background:rgba(255,255,255,0.2)
                padding:5px 25px
                position:absolute
                top:70px
                right:30px
                border-radius:15px
    
</style>